ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Bembidion_Adult Class Reference

The class describing the adult (female) beetle objects. More...

#include <bembidion_all.h>

Inheritance diagram for Bembidion_Adult:
Bembidion_Base TAnimal TALMaSSObject

Public Member Functions

 Bembidion_Adult (int x, int y, Landscape *L, Bembidion_Population_Manager *BPM)
 
void ReInit (int x, int y, Landscape *L, Bembidion_Population_Manager *BPM)
 ReInit for object pool. More...
 
virtual ~Bembidion_Adult ()
 
virtual void Step ()
 Adult Step. More...
 
virtual void BeginStep ()
 Adult BeginStep. More...
 
virtual void EndStep ()
 Adult EndStep. More...
 
void SetBodyBurden (double a_pcide)
 
void SetPPPThreshold (double a_thresh)
 
void SetPPPEffectProb (double a_conc)
 
void SetPPPEffectProbDecay (double a_decay)
 
void SetAdultPPPElimRate (double a_rate)
 
- Public Member Functions inherited from Bembidion_Base
 Bembidion_Base (int x, int y, Landscape *L, Bembidion_Population_Manager *BPM)
 Constructor. More...
 
void ReInit (int x, int y, Landscape *L, Bembidion_Population_Manager *BPM)
 ReInit for object pool. More...
 
virtual void st_Die ()
 Common state Die. More...
 
void CopyMyself (int a_beetle)
 For experimental purposes. More...
 
void CopyMyselfB (int a_beetle)
 For experimental purposes. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

void Init ()
 Intitialise attribute values. More...
 
int st_Forage ()
 Foraging behaviour. More...
 
int st_Aggregate ()
 Aggregation behaviour. More...
 
int st_Hibernate ()
 Hibernation behaviour. More...
 
int st_Dispersal ()
 Intiate Dispersal behaviour. More...
 
bool st_Aging ()
 Daily ageing. More...
 
bool WinterMort ()
 Density-independent winter mortality. More...
 
bool DDepMort ()
 Density-dependent mortality. More...
 
int DailyMovement (int p_distance, bool disp_aggreg)
 Initiates the daily movement for the beelt. More...
 
void MoveTo (int p_dist, unsigned p_direction, int p_turning)
 Moves attempting egg laying under way. More...
 
int MoveTo_quality_assess ()
 Moves w.r.t. habitat quality only. More...
 
int MoveToAggr (int p_dist, unsigned p_direction, int p_turning)
 Moves using a stopping rule for hibernation. More...
 
void Reproduce (int p_x, int p_y)
 Produces the eggs. More...
 
void CanReproduce ()
 Does reproduction if possible. More...
 
virtual bool DailyMortality ()
 Density-independent mortality. More...
 
virtual bool OnFarmEvent (FarmToDo event)
 Adult reactions to management events. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Hand pesticide events code for the beetle. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

double m_negDegrees
 The number of negative day degrees experienced. More...
 
double m_HibernateDegrees
 The number of day degrees experienced in the spring which may trigger dispersal. More...
 
int OldDirection
 The last direction moved. More...
 
int m_EggCounter
 The number of eggs produced. More...
 
bool m_CanReproduce
 Signal reproductive readiness. More...
 
double m_body_burden
 Current body burden of pesticide. More...
 
double m_currentPPPEffectProb
 Current effect probability. More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Static Protected Attributes

static param_List15 pList
 A helper attribute when simulating movement. More...
 
static param_Point pPoint
 A helper attribute when simulating movement. More...
 
static double m_AdultPPPElimRate = 0
 the daily elimination rate for pesticides More...
 
static double m_PPPThreshold = 0
 PPP effects threshold. More...
 
static double m_PPPEffectProb = 0
 Effect probability on threshold excedence. More...
 
static double m_PPPEffectProbDecay = 0
 Effect probability on threshold excedence. More...
 

Additional Inherited Members

- Public Attributes inherited from Bembidion_Base
TTypesOfBeetleState CurrentBState
 Current behavioural state. More...
 
Bembidion_Population_Managerm_OurPopulation
 Pointer to the population manager. More...
 

Detailed Description

The class describing the adult (female) beetle objects.

Constructor & Destructor Documentation

◆ Bembidion_Adult()

Bembidion_Adult::Bembidion_Adult ( int  x,
int  y,
Landscape L,
Bembidion_Population_Manager BPM 
)

Constructor

1366  :
1367 Bembidion_Base( x, y, L, BPM ) {
1368  Init();
1369 }
void Init()
Intitialise attribute values.
Definition: Bembidion_all.cpp:1383
Bembidion_Base(int x, int y, Landscape *L, Bembidion_Population_Manager *BPM)
Constructor.
Definition: Bembidion_all.cpp:205

References Init().

◆ ~Bembidion_Adult()

Bembidion_Adult::~Bembidion_Adult ( )
virtual

Destructor

1379 {
1380 }

Member Function Documentation

◆ BeginStep()

void Bembidion_Adult::BeginStep ( void  )
virtual

Adult BeginStep.

Reimplemented from Bembidion_Base.

2190 {
2191  CheckManagement();
2192  // Die if mortality occurs or is too old
2194 }
@ tobs_ADying
Definition: bembidion_all.h:53
bool st_Aging()
Daily ageing.
Definition: Bembidion_all.cpp:1681
TTypesOfBeetleState CurrentBState
Current behavioural state.
Definition: bembidion_all.h:159
void CheckManagement(void)
Definition: PopulationManager.cpp:1404

References TAnimal::CheckManagement(), Bembidion_Base::CurrentBState, st_Aging(), and tobs_ADying.

◆ CanReproduce()

void Bembidion_Adult::CanReproduce ( )
protected

Does reproduction if possible.

1863 {
1864  //are we reproducing?
1865  if (m_CanReproduce)
1866  {
1869  // First find out how many eggs to produce depending on temperature
1871  // Calcuated in the pop man so it only needs calculating once
1872  switch(tole)
1873  {
1874  case tole_Field:
1875  case tole_Orchard:
1876  case tole_FieldBoundary:
1878  break;
1879  case tole_PermPasture:
1882  case tole_RoadsideVerge:
1883  case tole_NaturalGrassDry: // 110
1884  case tole_NaturalGrassWet:
1885  case tole_YoungForest:
1886  case tole_MownGrass:
1887  case tole_BeetleBank:
1888  case tole_WaterBufferZone:
1889  NoEggs = NoEggs>>1;
1890  break;
1891  default:
1892  NoEggs=0;
1893  break;
1894  }
1895  if (NoEggs>0)
1896  {
1897  for (int i=0; i<NoEggs; i++)
1898  {
1899  int place=random(pList.nsteps);
1900  Reproduce(pList.BeenThereX[place],pList.BeenThereY[place]);
1901  }
1902  m_EggCounter-=NoEggs;
1903  // _EggCounter will go negative when all eggs are used
1904  //- allows a small over-production
1905  }
1906  }
1907 };
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
void Reproduce(int p_x, int p_y)
Produces the eggs.
Definition: Bembidion_all.cpp:1910
bool m_CanReproduce
Signal reproductive readiness.
Definition: bembidion_all.h:363
static param_List15 pList
A helper attribute when simulating movement.
Definition: bembidion_all.h:365
int m_EggCounter
The number of eggs produced.
Definition: bembidion_all.h:361
Bembidion_Population_Manager * m_OurPopulation
Pointer to the population manager.
Definition: bembidion_all.h:161
int TodaysEggProduction
Daily temperature determined egg production.
Definition: bembidion_all.h:482
TTypesOfLandscapeElement SupplyElementType(int a_polyref)
Definition: landscape.h:1110
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
int BeenThereY[101]
Definition: bembidion_all.h:107
int BeenThereX[101]
Definition: bembidion_all.h:106
int nsteps
Definition: bembidion_all.h:108
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
@ tole_PermPastureTussocky
Definition: tole_declaration.h:45
@ tole_WaterBufferZone
Definition: tole_declaration.h:108
@ tole_NaturalGrassWet
Definition: tole_declaration.h:87
@ tole_NaturalGrassDry
Definition: tole_declaration.h:48
@ tole_Field
Definition: tole_declaration.h:43
@ tole_PermPasture
Definition: tole_declaration.h:47
@ tole_FieldBoundary
Definition: tole_declaration.h:40
@ tole_RoadsideVerge
Definition: tole_declaration.h:38
@ tole_Orchard
Definition: tole_declaration.h:71
@ tole_MownGrass
Definition: tole_declaration.h:74
@ tole_YoungForest
Definition: tole_declaration.h:55
@ tole_PermPastureLowYield
Definition: tole_declaration.h:44
@ tole_UnsprayedFieldMargin
Definition: tole_declaration.h:72
@ tole_BeetleBank
Definition: tole_declaration.h:69

References param_List15::BeenThereX, param_List15::BeenThereY, m_CanReproduce, m_EggCounter, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Bembidion_Base::m_OurPopulation, param_List15::nsteps, pList, random(), Reproduce(), Landscape::SupplyElementType(), Bembidion_Population_Manager::TodaysEggProduction, tole_BeetleBank, tole_Field, tole_FieldBoundary, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_RoadsideVerge, tole_UnsprayedFieldMargin, tole_WaterBufferZone, and tole_YoungForest.

Referenced by MoveTo().

◆ DailyMortality()

bool Bembidion_Adult::DailyMortality ( )
protectedvirtual

Density-independent mortality.

Determines whether mortality has occured due to density-independen factors. Uses DailyAdultMort as a probability of dying.

2307 {
2308  if (g_rand_uni()<DailyAdultMort)
2309  {
2310  return true;
2311  }
2312  return false;
2313 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
const double DailyAdultMort
Daily fixed mortality probability.
Definition: Bembidion_all.cpp:112

References DailyAdultMort, and g_rand_uni.

Referenced by st_Aging().

◆ DailyMovement()

int Bembidion_Adult::DailyMovement ( int  p_distance,
bool  p_disp_aggreg 
)
protected

Initiates the daily movement for the beelt.

Depending whether the beetle is dispersing or aggregating this calls either MoveTo or MoveToAggr.

1725 {
1726  // If its too cold then do not do any movement today
1727  if (m_OurLandscape->SupplyTemp() < 1.0) return 0;
1728  // are we aggregating or dispersing?
1729  if (p_disp_aggreg == true)
1730  {
1731  // Dispersing
1732  int turning = AdultTurnRate; // almost no change of turning
1733  // Do the movement
1734  MoveTo(p_distance, OldDirection, turning);
1735  if (DDepMort()) return 2; // die
1736  return 0; // carry on dispersing
1737  }
1738  else
1739  {
1740  return MoveToAggr(p_distance, OldDirection, AdultTurnRate);
1741  }
1742 }
const int AdultTurnRate
Definition: Bembidion_all.cpp:147
int OldDirection
The last direction moved.
Definition: bembidion_all.h:359
void MoveTo(int p_dist, unsigned p_direction, int p_turning)
Moves attempting egg laying under way.
Definition: Bembidion_all.cpp:1746
int MoveToAggr(int p_dist, unsigned p_direction, int p_turning)
Moves using a stopping rule for hibernation.
Definition: Bembidion_all.cpp:1974
bool DDepMort()
Density-dependent mortality.
Definition: Bembidion_all.cpp:2321
double SupplyTemp(void)
Definition: landscape.h:1386

References AdultTurnRate, DDepMort(), TAnimal::m_OurLandscape, MoveTo(), MoveToAggr(), OldDirection, and Landscape::SupplyTemp().

Referenced by st_Aggregate(), st_Dispersal(), and st_Forage().

◆ DDepMort()

bool Bembidion_Adult::DDepMort ( )
protected

Density-dependent mortality.

Determines whether mortality has occured due to density-dependence. Uses ADDepMort1 as a probability of dying if adult beetles are found by GetMapDensity.

2322 {
2323 // Modified ***CJT*** 26-05-2009
2324  int range=cfg_DDepRange.value();
2325  int x=m_Location_x;
2326  int y=m_Location_y;
2327  // Find out if there is any danger of using wrap round
2328  if ((x<0)||(y<0)|| (x>=m_OurPopulation->SimW-range) ||(y>=m_OurPopulation->SimH-range))
2329  {
2330  int diff = 0;
2331  if (x<0) {
2332  diff = abs(x);
2333  } else if (x>=m_OurPopulation->SimW-range) diff = (x+range)-m_OurPopulation->SimW;
2334  if (y<0) {
2335  if (diff< abs(y)) diff = abs(y);
2336  } else if (y>=m_OurPopulation->SimH-range){
2337  int diff2=(y+range)-m_OurPopulation->SimH;
2338  if (diff2>diff) diff=diff2;
2339  }
2340  range-=diff;
2341  }
2343  if (g_rand_uni()<m_OurPopulation->ADDepMort1) return true; // die
2344  }
2345  return false;
2346 }
static CfgInt cfg_DDepRange("BEM_DDEPRANGE", CFG_CUSTOM, 3)
Adult/Larve density dependent range.
SimplePositionMap * m_AdultPosMap
Optimsied map of adult positions.
Definition: bembidion_all.h:472
double ADDepMort1
Storage for density-dependent mortality parameter.
Definition: bembidion_all.h:480
int ADDepMort0
Storage for density-dependent mortality parameter.
Definition: bembidion_all.h:478
int value(void)
Definition: configurator.h:98
int SimH
Definition: PopulationManager.h:511
int SimW
Definition: PopulationManager.h:511
virtual int GetMapDensity(unsigned a_x, unsigned a_y, unsigned a_range)
Definition: positionmap.h:66

References Bembidion_Population_Manager::ADDepMort0, Bembidion_Population_Manager::ADDepMort1, cfg_DDepRange, g_rand_uni, SimplePositionMap::GetMapDensity(), Bembidion_Population_Manager::m_AdultPosMap, TAnimal::m_Location_x, TAnimal::m_Location_y, Bembidion_Base::m_OurPopulation, Population_Manager::SimH, Population_Manager::SimW, and CfgInt::value().

Referenced by DailyMovement().

◆ EndStep()

void Bembidion_Adult::EndStep ( void  )
virtual

Adult EndStep.

Reimplemented from Bembidion_Base.

2198 {
2199 #ifdef __BEETLEPESTICIDE1
2201  // Pick up the pesticide to add to the body burden
2204  if (m_currentPPPEffectProb != 0)
2205  {
2206  // Kill the beetle following a fixed probability of death. The test is taken each day until it dies.
2208  }
2209 #endif
2210 }
double m_body_burden
Current body burden of pesticide.
Definition: bembidion_all.h:371
static double m_AdultPPPElimRate
the daily elimination rate for pesticides
Definition: bembidion_all.h:369
virtual void InternalPesticideHandlingAndResponse()
Hand pesticide events code for the beetle.
Definition: Bembidion_all.cpp:2157
double m_currentPPPEffectProb
Current effect probability.
Definition: bembidion_all.h:373
virtual void st_Die()
Common state Die.
Definition: Bembidion_all.cpp:224
double SupplyPesticide(int a_x, int a_y, PlantProtectionProducts a_ppp)
Gets total pesticide for a location.
Definition: Landscape.cpp:586
@ ppp_1
Definition: farm.h:422

References g_rand_uni, InternalPesticideHandlingAndResponse(), m_AdultPPPElimRate, m_body_burden, m_currentPPPEffectProb, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, ppp_1, Bembidion_Base::st_Die(), and Landscape::SupplyPesticide().

◆ Init()

void Bembidion_Adult::Init ( )
protected

Intitialise attribute values.

1384 {
1385  m_negDegrees=0; //No negative degrees to sum
1386  // don't want to start accumulating Hibernate degrees until Jan 1st
1387  m_HibernateDegrees=-99999;
1388  OldDirection=random(8);
1389  m_EggCounter=0;
1390  m_CanReproduce=false;
1391  m_body_burden = 0;
1393 }
double m_HibernateDegrees
The number of day degrees experienced in the spring which may trigger dispersal.
Definition: bembidion_all.h:356
double m_negDegrees
The number of negative day degrees experienced.
Definition: bembidion_all.h:354

References m_body_burden, m_CanReproduce, m_currentPPPEffectProb, m_EggCounter, m_HibernateDegrees, m_negDegrees, OldDirection, and random().

Referenced by Bembidion_Adult(), and ReInit().

◆ InternalPesticideHandlingAndResponse()

void Bembidion_Adult::InternalPesticideHandlingAndResponse ( )
protectedvirtual

Hand pesticide events code for the beetle.

If the body burden exceeds the trigger then an effect is tested for and implemented depending on the pesticide type.

2157  {
2161  // Test against the threshold level for Adult to determine if an effect needs to be tested for
2162  if (m_body_burden > m_PPPThreshold) {
2163  // We are above the PPP body burden threshold, so make a test for effect
2164  if (g_rand_uni() <m_PPPEffectProb) {
2166  switch (tp) {
2167  case ttop_NoPesticide:
2168  break;
2169  case ttop_ReproductiveEffects: // Reproductive effects
2170  // TODO
2171  break;
2172  case ttop_AcuteEffects: // Acute mortality
2173  st_Die(); // Kill this one now
2174  break;
2177  break;
2178  case ttop_MultipleEffects:
2179  break;
2180  default:
2181  g_msg->Warn("Unknown pesticide type used in Bembidion_Adult::InternalPesticideHandlingAndResponse() pesticide code ", int(tp));
2182  exit(47);
2183  }
2184  }
2185  }
2186 }
static double m_PPPThreshold
PPP effects threshold.
Definition: bembidion_all.h:375
static double m_PPPEffectProbDecay
Effect probability on threshold excedence.
Definition: bembidion_all.h:379
static double m_PPPEffectProb
Effect probability on threshold excedence.
Definition: bembidion_all.h:377
TTypesOfPesticide SupplyPesticideType(void)
Definition: landscape.h:433
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
TTypesOfPesticide
Definition: landscape.h:66
@ ttop_NoPesticide
Definition: landscape.h:67
@ ttop_AcuteEffects
Definition: landscape.h:68
@ ttop_MultipleEffects
Definition: landscape.h:74
@ ttop_AcuteDelayedEffects
Definition: landscape.h:76
@ ttop_ReproductiveEffects
Definition: landscape.h:69
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41

References g_msg, g_rand_uni, m_body_burden, m_currentPPPEffectProb, TAnimal::m_OurLandscape, m_PPPEffectProb, m_PPPEffectProbDecay, m_PPPThreshold, Bembidion_Base::st_Die(), Landscape::SupplyPesticideType(), ttop_AcuteDelayedEffects, ttop_AcuteEffects, ttop_MultipleEffects, ttop_NoPesticide, ttop_ReproductiveEffects, and MapErrorMsg::Warn().

Referenced by EndStep().

◆ MoveTo()

void Bembidion_Adult::MoveTo ( int  p_dist,
unsigned  p_direction,
int  p_turning 
)
protected

Moves attempting egg laying under way.

Move p_distance steps in p_direction with p_turning out of 100 chance of changing p_direction. This function will alter m_Location_x & m_Location_y.
p_direction gives the preferred direction (0-7)
p_distance is the number of steps
The beetles will stop moving in suitable hibernatio habitat late in the year.

This method is very similar to Bembidion_Adult::MoveToAggr but differs in the direction of movement relative to habitat types and the end of movement behaviour. In this case the beetl tries to lay eggs in MoveToAggre it test for hibernation conditions.

Try to reproduce

1747 {
1759  int vx = m_Location_x;
1760  int vy = m_Location_y;
1761  pPoint.direction=p_direction;
1762  pList.nsteps=0;
1763  if (random(100)<p_turning)
1764  {
1765  // change direction
1766  if (random(2)==1) pPoint.direction=((1+pPoint.direction) & 7U);
1767  else pPoint.direction=((7+pPoint.direction) & 0x07); //same as p_direction-1 but +ve
1768  }
1769 
1770  /*
1771  Improved speed here by checking if the max distance goes out of bounds
1772  i.e. x+p_distance, y+p_distance & x-p_distance,y-p_distance
1773  if not then there is no need to check for out of bounds later at all
1774  */
1775 
1776  if ((vx-p_distance<0) || (vy-p_distance<0) || (vx+p_distance>=m_OurPopulation->SimW)
1777  || (vy+p_distance>=m_OurPopulation->SimH))
1778  {
1779  //---- Duplicated with out of bounds check for speed
1780  for (int i=0; i<p_distance; i++)
1781  {
1782  // test the squares at Vector, Vector+1+2, Vector-1-2
1783  // if they are inaccessible (water,buildings,forest) try another square
1784  //
1785  int qual=3;
1786  int tries=0;
1787  while ((qual==3)&&(tries++<10))
1788  {
1789  // first watch out for out of bounds
1792  if (pPoint.x<0) pPoint.x=
1794  else if (pPoint.x>=m_OurPopulation->SimW)
1796  if (pPoint.y<0)
1797  {
1799  }
1800  else if (pPoint.y>=m_OurPopulation->SimH)
1801  {
1803  }
1804  qual=MoveTo_quality_assess();
1805  }
1806  if (qual!=3)
1807  {
1810  vx=pPoint.x;
1811  vy=pPoint.y;
1813  }
1814  else
1815  {
1817  pList.BeenThereY[pList.nsteps++]=vy;
1818  }
1819  }
1820  }
1821  //---- Duplicated for speed
1822  else // No Out of bounds possible
1823  {
1824  for (int i=0; i<p_distance; i++)
1825  {
1826  // test the squares at Vector, Vector+1+2, Vector-1-2
1827  // if they are inaccessible (water,buildings,forest) try another square
1828  //
1829  int qual=3;
1830  int tries=0;
1831  while ((qual==3)&&(tries++<10))
1832  {
1835  qual=MoveTo_quality_assess();
1836  }
1837  if (qual!=3)
1838  {
1841  vx=pPoint.x;
1842  vy=pPoint.y;
1844  }
1845  else
1846  {
1848  pList.BeenThereY[pList.nsteps++]=vy;
1849  }
1850  }
1851  }
1852  // alter the location
1854  m_Location_x=vx;
1855  m_Location_y=vy;
1858  CanReproduce();
1859 }
const int Vector_x[8]
const int Vector_y[8]
static param_Point pPoint
A helper attribute when simulating movement.
Definition: bembidion_all.h:367
int MoveTo_quality_assess()
Moves w.r.t. habitat quality only.
Definition: Bembidion_all.cpp:1931
void CanReproduce()
Does reproduction if possible.
Definition: Bembidion_all.cpp:1862
virtual void SetMapValue(unsigned a_x, unsigned a_y)
Definition: positionmap.h:56
virtual void ClearMapValue(unsigned a_x, unsigned a_y)
Definition: positionmap.h:61
int y
Definition: bembidion_all.h:98
unsigned direction
Definition: bembidion_all.h:99
int x
Definition: bembidion_all.h:97

References param_List15::BeenThereX, param_List15::BeenThereY, CanReproduce(), SimplePositionMap::ClearMapValue(), param_Point::direction, Bembidion_Population_Manager::m_AdultPosMap, TAnimal::m_Location_x, TAnimal::m_Location_y, Bembidion_Base::m_OurPopulation, MoveTo_quality_assess(), param_List15::nsteps, OldDirection, pList, pPoint, random(), SimplePositionMap::SetMapValue(), Population_Manager::SimH, Population_Manager::SimW, Vector_x, Vector_y, param_Point::x, and param_Point::y.

Referenced by DailyMovement().

◆ MoveTo_quality_assess()

int Bembidion_Adult::MoveTo_quality_assess ( )
inlineprotected

Moves w.r.t. habitat quality only.

A version of MoveTo where movement is determined by the suitability of the habitat moved to.

1932 {
1933  int qual;
1934  // get the quality of the test area
1935  // if it is 3 then don't go here
1936  // 2 can walk there but it is non-habitat
1937  // 1 linear features e.g. hedges, roadside verges
1938  // 1 grassland
1939  // 0 crop field
1941  {
1943  }
1944  else qual=3;
1945  // if it is 3 then don't go here
1946  switch (qual)
1947  {
1948  case 3: // Cannot go
1949  // try another direction
1950  if (random(2)==1) pPoint.direction=((1+pPoint.direction) & 0x07);
1951  else pPoint.direction=((7+pPoint.direction)& 0x07);
1952  break;
1953  case 2:
1954  // Have a 40% chance of moving on to it
1955  if (random(100)>=40)
1956  {
1957  // try another direction
1958  if (random(2)==1) pPoint.direction=((1+pPoint.direction) & 0x07);
1959  else pPoint.direction=((7+pPoint.direction) & 0x07); // Reverse
1960  break;
1961  }
1962  case 1:
1963  case 0:
1964  break;
1965  default:
1966  // Should never happen
1967  m_OurLandscape->Warn("Bembidion Adult:: MoveTo QA Bad Direction",NULL);
1968  exit(1);
1969  }
1970  return qual;
1971 }
MovementMap * m_MoveMap
Map of suitability for movement.
Definition: bembidion_all.h:468
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
int GetMapValue(unsigned x, unsigned y)
Definition: MovementMap.cpp:409
virtual bool GetMapValue(unsigned a_x, unsigned a_y)
Definition: positionmap.h:51

References param_Point::direction, SimplePositionMap::GetMapValue(), MovementMap::GetMapValue(), Bembidion_Population_Manager::m_AdultPosMap, Bembidion_Population_Manager::m_MoveMap, TAnimal::m_OurLandscape, Bembidion_Base::m_OurPopulation, pPoint, random(), Landscape::Warn(), param_Point::x, and param_Point::y.

Referenced by MoveTo().

◆ MoveToAggr()

int Bembidion_Adult::MoveToAggr ( int  p_dist,
unsigned  p_direction,
int  p_turning 
)
protected

Moves using a stopping rule for hibernation.

Move p_distance steps in p_direction with p_turning out of 100 chance of changing p_direction. This function will alter m_Location_x & m_Location_y.
p_direction gives the preferred direction (0-7)
p_distance is the number of steps
The beetles will stop moving in suitable hibernatio habitat late in the year.

1975 {
1983  int vx = m_Location_x;
1984  int vy = m_Location_y;
1985  int tvx=0;
1986  int tvy=0;
1987  if (random(100)<p_turning)
1988  {
1989  // change direction
1990  if (random(2)==1) p_direction=((1+p_direction) & 0x07);
1991  else p_direction=((7+p_direction) & 0x07);
1992  }
1993 
1994  /*
1995  Improved speed here by checking if the max distance goes out of bounds
1996  i.e. x+p_distance, y+p_distance & x-p_distance,y-p_distance
1997  if not then there is no need to check for out of bounds later at all
1998  */
1999  if ((vx-p_distance<0) || (vy-p_distance<0)
2000  || (vx+p_distance>=m_OurPopulation->SimW)
2001  || (vy+p_distance>=m_OurPopulation->SimH))
2002  {
2003  //---- Duplicated with out of bounds check for speed
2004  for (int i=0; i<p_distance; i++)
2005  {
2006  // test the squares at Vector, Vector+1+2, Vector-1-2
2007  // if they are inaccessible (water,buildings,forest) try another square
2008  //
2009  int qual=3;
2010  int tries=0;
2011  while ((qual==3)&&(tries++<10))
2012  {
2013  // first watch out for out of bounds
2014  tvx=vx+Vector_x[p_direction];
2015  tvy=vy+Vector_y[p_direction];
2016  if (tvx<0) tvx=(tvx+m_OurPopulation->SimW)%m_OurPopulation->SimW;
2017  else if (tvx>=m_OurPopulation->SimW) tvx=tvx%m_OurPopulation->SimW;
2018  if (tvy<0) {tvy=(tvy+m_OurPopulation->SimH)%m_OurPopulation->SimH;}
2019  else if (tvy>=m_OurPopulation->SimH) {tvy=tvy%m_OurPopulation->SimH;}
2020  // get the quality of the test area
2021  qual = m_OurPopulation->m_MoveMap->GetMapValue(tvx,tvy);
2022  // if it is 3 then don't go here
2023  switch (qual)
2024  {
2025  case 3: // Cannot go
2026  // try another direction
2027  if (random(2)==1) p_direction=((1+p_direction) & 0x07);
2028  else p_direction=((7+p_direction) & 0x07);
2029  break;
2030  case 2:
2031  // Have a 40% chance of moving on to it
2032  if (random(100)>=40)
2033  {
2034  // try another direction
2035  if (random(2)==1) p_direction=((1+p_direction) & 0x07);
2036  else p_direction=((7+p_direction) & 0x07);
2037  break;
2038  }
2039  case 1:
2040  // This is where we want to be
2041  i=p_distance;
2042  case 0:
2043  break;
2044  default:
2045  // Should never happen
2046  m_OurLandscape->Warn("Bembidion Adult:: MoveTo Aggr Bad Direction",NULL);
2047  exit(1);
2048  }
2049  }
2050  if (qual!=3)
2051  {
2052  vx=tvx;
2053  vy=tvy;
2054  OldDirection=p_direction;
2055  }
2056  }
2057  }
2058  //---- Duplicated for speed
2059  else // No Out of bounds possible
2060  {
2061  for (int i=0; i<p_distance; i++)
2062  {
2063  tvx=vx+Vector_x[p_direction];
2064  tvy=vy+Vector_y[p_direction];
2065  // if they are inaccessible (water,buildings,forest) try another square
2066  //
2067  int qual=3;
2068  int tries=0;
2069  while ((qual==3)&(tries++<10))
2070  {
2071  // get the quality of the test area
2072  // if it is 3 then don't go here
2073  // 2 can walk there but it is non-habitat
2074  // 1 linear features e.g. hedges, roadside verges
2075  // 1 grassland
2076  // 0 crop field
2077  qual = m_OurPopulation->m_MoveMap->GetMapValue(tvx,tvy);
2078  // if it is 3 then don't go here
2079  switch (qual)
2080  {
2081  case 3: // Cannot go
2082  // try another direction
2083  if (random(2)==1) p_direction=((1+p_direction) & 0x07);
2084  else p_direction=((7+p_direction) & 0x07);
2085  break;
2086  case 2:
2087  // Have a 40% chance of moving on to it
2088  if (random(100)>=40)
2089  {
2090  // try another direction
2091  if (random(2)==1) p_direction=((1+p_direction) & 0x07);
2092  else p_direction=((7+p_direction) & 0x07);
2093  break;
2094  }
2095  case 1:
2096  // where we want to be so stop for a while
2097  i=p_distance;
2098  case 0:
2099  break;
2100  default:
2101  // Should never happen
2102  m_OurLandscape->Warn("Bembidion Adult:: MoveTo Aggr 2 Bad Direction",NULL);
2103  exit(1);
2104  }
2105  }
2106  if (qual!=3)
2107  {
2108  vx=tvx;
2109  vy=tvy;
2110  OldDirection=p_direction;
2111  }
2112  }
2113  }
2114  // alter the location
2116  m_Location_x=vx;
2117  m_Location_y=vy;
2120  if (m_OurLandscape->SupplyDayInYear()>363)
2121  {
2122  // Has reached January so must decide if can hibernate here or die
2123  if ((hab==1)||(random(100)<FieldHibernateChance)) return 1;
2124  else return 2; // die
2125  }
2126  else
2128  {
2130  switch (tole)
2131  {
2132  case tole_Hedges: // 130
2133  case tole_RoadsideVerge: // 13
2134  case tole_FieldBoundary: // 160
2135  case tole_HedgeBank:
2136  case tole_BeetleBank:
2137  case tole_PermPasture: // 35
2138  case tole_PermPastureLowYield: // 35
2139  case tole_PermPastureTussocky: // 26
2140  case tole_Heath:
2141  case tole_NaturalGrassDry: // 110
2142  case tole_NaturalGrassWet:
2143  case tole_AmenityGrass:
2144  case tole_Orchard: //55
2145  case tole_MownGrass: //58
2146  case tole_YoungForest:
2147  case tole_WaterBufferZone:
2148  return 1; //late in year in an OK place so stop
2149  default:
2150  return 0; // Carry on aggregating
2151  }
2152  }
2153  return 0; // Carry on aggregating
2154 }
const int StopAggregationDay
Definition: Bembidion_all.cpp:153
const int FieldHibernateChance
Definition: Bembidion_all.cpp:143
int SupplyDayInYear(void)
Definition: landscape.h:1596
@ tole_Hedges
Definition: tole_declaration.h:37
@ tole_Heath
Definition: tole_declaration.h:70
@ tole_AmenityGrass
Definition: tole_declaration.h:76
@ tole_HedgeBank
Definition: tole_declaration.h:68

References SimplePositionMap::ClearMapValue(), FieldHibernateChance, MovementMap::GetMapValue(), Bembidion_Population_Manager::m_AdultPosMap, TAnimal::m_Location_x, TAnimal::m_Location_y, Bembidion_Population_Manager::m_MoveMap, TAnimal::m_OurLandscape, Bembidion_Base::m_OurPopulation, OldDirection, random(), SimplePositionMap::SetMapValue(), Population_Manager::SimH, Population_Manager::SimW, StopAggregationDay, Landscape::SupplyDayInYear(), Landscape::SupplyElementType(), tole_AmenityGrass, tole_BeetleBank, tole_FieldBoundary, tole_Heath, tole_HedgeBank, tole_Hedges, tole_MownGrass, tole_NaturalGrassDry, tole_NaturalGrassWet, tole_Orchard, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_RoadsideVerge, tole_WaterBufferZone, tole_YoungForest, Vector_x, Vector_y, and Landscape::Warn().

Referenced by DailyMovement().

◆ OnFarmEvent()

bool Bembidion_Adult::OnFarmEvent ( FarmToDo  event)
protectedvirtual

Adult reactions to management events.

Reimplemented from TAnimal.

1398 {
1399  switch(event)
1400  {
1401  case sleep_all_day:
1402  break;
1403  case autumn_plough:
1405  break;
1406  case stubble_plough: // assumed to be the same as for autumn plough
1408  break;
1409  case stubble_cultivator_heavy: // assumed to be the same as for autumn plough
1411  break;
1412  case heavy_cultivator_aggregate: // assumed to be the same as for autumn plough
1414  break;
1415  case autumn_harrow:
1417  break;
1418  case preseeding_cultivator: // assumed to be the same as for harrow
1420  break;
1421  case preseeding_cultivator_sow: // assumed to be the same as for harrow
1423  break;
1424  case autumn_roll:
1426  break;
1427  case autumn_sow:
1429  break;
1430  case winter_plough:
1432  break;
1433  case deep_ploughing:
1435  break;
1436  case spring_plough:
1438  break;
1439  case spring_harrow:
1441  break;
1442  case shallow_harrow:
1444  break;
1445  case spring_roll:
1446  break;
1447  case spring_sow:
1448  break;
1449  case spring_sow_with_ferti:
1450  break;
1451 case fp_npks:
1452  break;
1453 case fp_npk:
1454  break;
1455 case fp_pk:
1456  break;
1457 case fp_liquidNH3:
1458  break;
1459 case fp_slurry:
1460  break;
1462  break;
1463 case fp_ammoniumsulphate:
1464  break;
1465 case fp_manure:
1466  break;
1467 case fp_greenmanure:
1468  break;
1469 case fp_sludge:
1470  break;
1471 case fp_rsm:
1472  break;
1473 case fp_calcium:
1474  break;
1475 case fa_npks:
1476  break;
1477 case fa_npk:
1478  break;
1479 case fa_pk:
1480  break;
1481 case fa_slurry:
1482  break;
1483 case fa_ammoniumsulphate:
1484  break;
1486  break;
1487 case fa_manure:
1488  break;
1489 case fa_greenmanure:
1490  break;
1491 case fa_sludge:
1492  break;
1493 case fa_rsm:
1494  break;
1495 case fa_calcium:
1496  break;
1497 case herbicide_treat:
1498  break;
1499 case growth_regulator:
1500  break;
1501 case fungicide_treat:
1502  break;
1503 case insecticide_treat:
1505  break;
1506 case molluscicide:
1507  break;
1508 case row_cultivation:
1509  break;
1510 case strigling:
1512  break;
1513 case hilling_up:
1514  break;
1515 case water:
1516  break;
1517 case swathing:
1518  break;
1519 case harvest:
1521  break;
1522 case cattle_out:
1523  break;
1524 case cattle_out_low:
1525  break;
1526 case cut_to_hay:
1527  break;
1528 case cut_to_silage:
1529  break;
1530 case straw_chopping:
1531  break;
1532 case hay_turning:
1533  break;
1534 case hay_bailing:
1535  break;
1536 case flammebehandling:
1537  break;
1538 case stubble_harrowing:
1539  break;
1542  break;
1543 case burn_straw_stubble:
1544  break;
1545 case mow:
1546  break;
1547 case cut_weeds:
1548  break;
1549 case pigs_out:
1550  break;
1551 case strigling_sow:
1553  break;
1554 case strigling_hill:
1556  break;
1559  break;
1560 case trial_toxiccontrol:
1562  break;
1563 case trial_control:
1564 case product_treat:
1565 case glyphosate:
1566  break;
1569  break;
1570 case biocide:
1571  break;
1572 case bed_forming:
1574  break;
1575 case flower_cutting:
1576  break;
1577 case bulb_harvest:
1579  break;
1580 case straw_covering:
1581  break;
1582 case straw_removal:
1583  break;
1584  default:
1585  m_OurLandscape->Warn("Bembidion Adult - Unknown Treatment in Daily Mortality"
1586  ,NULL);
1587  exit(1);
1588  }
1589  // Must incorporate a test here in case the animal is dead - killing it twice
1590  // can be a bad idea
1591  if (CurrentBState==tobs_ADying) return true;
1592  else
1593  return false;
1594 }
static CfgFloat cfg_Adult_InsecticideApplication("BEM_ADULTINSECTICIDEMORT", CFG_CUSTOM, 0.800)
const int PesticideTrialAdultToxicMort
Definition: Bembidion_all.cpp:187
static CfgFloat cfg_BeetleHarvestMort("BEM_HARVESTMORT", CFG_CUSTOM, 0.290)
static CfgInt cfg_PesticideTrialAdultTreatmentMort("BEM_PTRIALADULTMORT", CFG_CUSTOM, 0)
static CfgFloat cfg_Adult_SoilCultivationMortality("BEM_ADULTSOILMORT", CFG_CUSTOM, 0.270)
static CfgFloat cfg_BeetleStriglingMort("BEM_STRIGLINGMORT", CFG_CUSTOM, 0.250)
double value(void)
Definition: configurator.h:118
@ burn_straw_stubble
Definition: treatment.h:92
@ autumn_harrow
Definition: treatment.h:37
@ swathing
Definition: treatment.h:81
@ fa_pk
Definition: treatment.h:62
@ winter_plough
Definition: treatment.h:42
@ strigling
Definition: treatment.h:77
@ shallow_harrow
Definition: treatment.h:107
@ straw_removal
Definition: treatment.h:112
@ fp_npks
Definition: treatment.h:48
@ glyphosate
Definition: treatment.h:102
@ fa_sludge
Definition: treatment.h:68
@ fp_liquidNH3
Definition: treatment.h:51
@ spring_roll
Definition: treatment.h:46
@ fa_greenmanure
Definition: treatment.h:67
@ spring_plough
Definition: treatment.h:44
@ fa_rsm
Definition: treatment.h:69
@ molluscicide
Definition: treatment.h:75
@ syninsecticide_treat
Definition: treatment.h:99
@ hay_turning
Definition: treatment.h:88
@ fa_manganesesulphate
Definition: treatment.h:64
@ autumn_roll
Definition: treatment.h:38
@ fp_manure
Definition: treatment.h:55
@ bed_forming
Definition: treatment.h:106
@ deep_ploughing
Definition: treatment.h:43
@ pigs_out
Definition: treatment.h:84
@ fa_npk
Definition: treatment.h:61
@ herbicide_treat
Definition: treatment.h:71
@ row_cultivation
Definition: treatment.h:76
@ heavy_cultivator_aggregate
Definition: treatment.h:108
@ spring_sow
Definition: treatment.h:47
@ fungicide_treat
Definition: treatment.h:73
@ fp_manganesesulphate
Definition: treatment.h:53
@ harvest
Definition: treatment.h:82
@ biocide
Definition: treatment.h:104
@ cut_to_silage
Definition: treatment.h:86
@ sleep_all_day
Definition: treatment.h:33
@ mow
Definition: treatment.h:93
@ preseeding_cultivator
Definition: treatment.h:39
@ fa_ammoniumsulphate
Definition: treatment.h:65
@ autumn_plough
Definition: treatment.h:34
@ straw_chopping
Definition: treatment.h:87
@ fa_manure
Definition: treatment.h:66
@ fp_greenmanure
Definition: treatment.h:56
@ fa_slurry
Definition: treatment.h:63
@ preseeding_cultivator_sow
Definition: treatment.h:40
@ product_treat
Definition: treatment.h:101
@ stubble_harrowing
Definition: treatment.h:90
@ hilling_up
Definition: treatment.h:79
@ straw_covering
Definition: treatment.h:111
@ growth_regulator
Definition: treatment.h:72
@ fp_ammoniumsulphate
Definition: treatment.h:54
@ trial_control
Definition: treatment.h:98
@ fp_rsm
Definition: treatment.h:58
@ stubble_cultivator_heavy
Definition: treatment.h:36
@ insecticide_treat
Definition: treatment.h:74
@ trial_insecticidetreat
Definition: treatment.h:96
@ cattle_out_low
Definition: treatment.h:100
@ cut_to_hay
Definition: treatment.h:85
@ cut_weeds
Definition: treatment.h:94
@ bulb_harvest
Definition: treatment.h:110
@ spring_sow_with_ferti
Definition: treatment.h:103
@ strigling_hill
Definition: treatment.h:105
@ fp_sludge
Definition: treatment.h:57
@ autumn_sow
Definition: treatment.h:41
@ fa_calcium
Definition: treatment.h:70
@ fp_npk
Definition: treatment.h:49
@ fp_pk
Definition: treatment.h:50
@ flammebehandling
Definition: treatment.h:78
@ trial_toxiccontrol
Definition: treatment.h:97
@ hay_bailing
Definition: treatment.h:89
@ spring_harrow
Definition: treatment.h:45
@ strigling_sow
Definition: treatment.h:95
@ stubble_plough
Definition: treatment.h:35
@ cattle_out
Definition: treatment.h:83
@ flower_cutting
Definition: treatment.h:109
@ fp_slurry
Definition: treatment.h:52
@ water
Definition: treatment.h:80
@ fa_npks
Definition: treatment.h:60
@ fp_calcium
Definition: treatment.h:59
@ autumn_or_spring_plough
Definition: treatment.h:91

References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, bed_forming, biocide, bulb_harvest, burn_straw_stubble, cattle_out, cattle_out_low, cfg_Adult_InsecticideApplication, cfg_Adult_SoilCultivationMortality, cfg_BeetleHarvestMort, cfg_BeetleStriglingMort, cfg_PesticideTrialAdultTreatmentMort, Bembidion_Base::CurrentBState, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, fa_ammoniumsulphate, fa_calcium, fa_greenmanure, fa_manganesesulphate, fa_manure, fa_npk, fa_npks, fa_pk, fa_rsm, fa_sludge, fa_slurry, flammebehandling, flower_cutting, fp_ammoniumsulphate, fp_calcium, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_rsm, fp_sludge, fp_slurry, fungicide_treat, g_rand_uni, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, TAnimal::m_OurLandscape, molluscicide, mow, PesticideTrialAdultToxicMort, pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, random(), row_cultivation, shallow_harrow, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, spring_sow_with_ferti, straw_chopping, straw_covering, straw_removal, strigling, strigling_hill, strigling_sow, stubble_cultivator_heavy, stubble_harrowing, stubble_plough, swathing, syninsecticide_treat, tobs_ADying, trial_control, trial_insecticidetreat, trial_toxiccontrol, CfgInt::value(), CfgFloat::value(), Landscape::Warn(), water, and winter_plough.

◆ ReInit()

void Bembidion_Adult::ReInit ( int  x,
int  y,
Landscape L,
Bembidion_Population_Manager BPM 
)

ReInit for object pool.

1372  {
1373  Bembidion_Base::ReInit( x, y, L, BPM );
1374  Init();
1375 }
void ReInit(int x, int y, Landscape *L, Bembidion_Population_Manager *BPM)
ReInit for object pool.
Definition: Bembidion_all.cpp:213

References Init(), and Bembidion_Base::ReInit().

◆ Reproduce()

void Bembidion_Adult::Reproduce ( int  p_x,
int  p_y 
)
protected

Produces the eggs.

1911 {
1912  struct_Bembidion * BS;
1913  BS = new struct_Bembidion;
1914  BS->x = p_x;
1915  BS->y = p_y;
1916  BS->L = m_OurLandscape;
1917  BS->BPM = m_OurPopulation;
1918  BS->DayDegrees=0;
1919  BS->HowMany=1;
1920  // don't need delete because object destroyed by Population_Manager
1921  m_OurPopulation->CreateObjects(0,this,NULL,BS,1);
1922  delete BS;
1923 }
void CreateObjects(int ob_type, TAnimal *pvo, void *null, struct_Bembidion *data, int number)
Method to add beetles to the population.
Definition: Bembidion_all.cpp:2942
A data class for Bembidion data.
Definition: bembidion_all.h:114
int DayDegrees
Definition: bembidion_all.h:116
int x
Definition: bembidion_all.h:117
Landscape * L
Definition: bembidion_all.h:119
int y
Definition: bembidion_all.h:118
int HowMany
Definition: bembidion_all.h:121
Bembidion_Population_Manager * BPM
Definition: bembidion_all.h:120

References struct_Bembidion::BPM, Bembidion_Population_Manager::CreateObjects(), struct_Bembidion::DayDegrees, struct_Bembidion::HowMany, struct_Bembidion::L, TAnimal::m_OurLandscape, Bembidion_Base::m_OurPopulation, struct_Bembidion::x, and struct_Bembidion::y.

Referenced by CanReproduce().

◆ SetAdultPPPElimRate()

void Bembidion_Adult::SetAdultPPPElimRate ( double  a_rate)
inline

Set body burden elimination rate for adults

316 { m_AdultPPPElimRate = a_rate; }

References m_AdultPPPElimRate.

Referenced by Bembidion_Population_Manager::Init().

◆ SetBodyBurden()

void Bembidion_Adult::SetBodyBurden ( double  a_pcide)
inline

Set body burden

308 { m_body_burden = a_pcide; }

References m_body_burden.

◆ SetPPPEffectProb()

void Bembidion_Adult::SetPPPEffectProb ( double  a_conc)
inline

Set body PPP effect probability

312 { m_PPPEffectProb = a_conc; }

References m_PPPEffectProb.

Referenced by Bembidion_Population_Manager::Init().

◆ SetPPPEffectProbDecay()

void Bembidion_Adult::SetPPPEffectProbDecay ( double  a_decay)
inline

Set body PPP effect probability

314 { m_PPPEffectProbDecay = a_decay; }

References m_PPPEffectProbDecay.

Referenced by Bembidion_Population_Manager::Init().

◆ SetPPPThreshold()

void Bembidion_Adult::SetPPPThreshold ( double  a_thresh)
inline

Set body PPP threshold

310 { m_PPPThreshold = a_thresh; }

References m_PPPThreshold.

Referenced by Bembidion_Population_Manager::Init().

◆ st_Aggregate()

int Bembidion_Adult::st_Aggregate ( )
protected

Aggregation behaviour.

1625 {
1626  return DailyMovement(random(MaxDailyMovement)+1, false);
1627 }
int MaxDailyMovement
Definition: Bembidion_all.cpp:145
int DailyMovement(int p_distance, bool disp_aggreg)
Initiates the daily movement for the beelt.
Definition: Bembidion_all.cpp:1724

References DailyMovement(), MaxDailyMovement, and random().

Referenced by Step().

◆ st_Aging()

bool Bembidion_Adult::st_Aging ( )
protected

Daily ageing.

1682 {
1683  double temp=m_OurLandscape->SupplyTemp();
1684  if (temp<0.0) m_negDegrees+=temp;
1685  // Check should the beetle die today if not hibernating
1687  {
1688  if (DailyMortality()) return true; // go to die
1689  if (m_CanReproduce)
1690  {
1691  if (m_EggCounter<0) return true; // All eggs laid so die
1692  }
1693  }
1694  return false; // carry on
1695 }
@ tobs_Hibernating
Definition: bembidion_all.h:51
virtual bool DailyMortality()
Density-independent mortality.
Definition: Bembidion_all.cpp:2306

References Bembidion_Base::CurrentBState, DailyMortality(), m_CanReproduce, m_EggCounter, m_negDegrees, TAnimal::m_OurLandscape, Landscape::SupplyTemp(), and tobs_Hibernating.

Referenced by BeginStep().

◆ st_Dispersal()

int Bembidion_Adult::st_Dispersal ( )
protected

Intiate Dispersal behaviour.

Will now move in a direction away from high densities of beetles and towards good habitat

1670 {
1671  if (WinterMort()) return 2; // die - a once only test
1676  return 0;
1677 }
bool WinterMort()
Density-independent winter mortality.
Definition: Bembidion_all.cpp:1698

References DailyMovement(), MaxDailyMovement, random(), and WinterMort().

Referenced by Step().

◆ st_Forage()

int Bembidion_Adult::st_Forage ( )
protected

Foraging behaviour.

If it is not yet time to start aggregating then the beetle does its daily movement and returns a zero value, indicating it will stay in this state. If date has exceeded StartAggregatingDay, then the beetle has a increasing probability with time of changing to aggregative behaviour.
If the beetle starts aggregating and it is from last season, then it is assumed that it will die.

1605 {
1606  if (DailyMovement(random(MaxDailyMovement)+1, true)==2) return 2;// Die
1607  int Day=m_OurLandscape->SupplyDayInYear();
1608  if (Day<StartAggregatingDay) return 0;
1609  else
1610  {
1611  if (random(100)<Day-StartAggregatingDayProb)
1612  {
1613  // Stop laying eggs now
1614  if (m_CanReproduce==true) // must be from last year so kill it
1615  return 2;
1616  return 1; // start aggregating
1617  }
1618  }
1619  return 0;
1620 }
const int StartAggregatingDay
Definition: Bembidion_all.cpp:149
const int StartAggregatingDayProb
Definition: Bembidion_all.cpp:151

References DailyMovement(), m_CanReproduce, TAnimal::m_OurLandscape, MaxDailyMovement, random(), StartAggregatingDay, StartAggregatingDayProb, and Landscape::SupplyDayInYear().

Referenced by Step().

◆ st_Hibernate()

int Bembidion_Adult::st_Hibernate ( )
protected

Hibernation behaviour.

Accumulates day degrees from the beginning of the year and starts dispersal when the sum exceeds a threshold or at the beginning of March.
At the end of hibernation the beetle is allowed to reproduce via the m_CanReproduce attribute.

1636 {
1637  int day=m_OurLandscape->SupplyDayInYear();
1638  if (day==0) m_HibernateDegrees=0;
1639  else if (day>100) return 0; // don't disperse if after spring
1640  double temp=m_OurLandscape->SupplyTemp();
1642  if ((day>=60)||(m_HibernateDegrees>=DipsersalDayDegrees))
1643  {
1644  //If we don't start dispersing then ensure we enter this code next time
1646  // test against the chance of dispersal
1647  // assume that it takes about one month to get 120 DDs
1648  // 30*(10-6)=120 - ALSO ASSUMES MEAN TEMP OF 10 DEGREES C
1649  // Therefore the probability of dispersing per day is that prob when
1650  // summed culmulatively gives 0.92 after 30 days (0.92 is the observed
1651  // dispersal % at 120DDs above 6 degrees C
1652  // this value is 0.081
1653  if (random(1000)<81)
1654  {
1655  m_CanReproduce=true;//Can only repoduce after hibernating else too young
1656  return 1; // dispersing
1657  }
1658  if (day>90)
1659  {
1660  m_CanReproduce=true;//Can only repoduce after hibernating else too young
1661  return 1; // dispersing
1662  }
1663  }
1664  return 0; // still hibernating
1665 }
const int DipsersalDayDegrees
Definition: Bembidion_all.cpp:141
const float DispersalThreshold
Adult dispersal temp threshold for DD calcuation.
Definition: Bembidion_all.cpp:139

References DipsersalDayDegrees, DispersalThreshold, m_CanReproduce, m_HibernateDegrees, TAnimal::m_OurLandscape, random(), Landscape::SupplyDayInYear(), and Landscape::SupplyTemp().

Referenced by Step().

◆ Step()

void Bembidion_Adult::Step ( void  )
virtual

Adult Step.

Reimplemented from Bembidion_Base.

2214 {
2215  if (m_StepDone || m_CurrentStateNo == -1) return;
2216  switch (CurrentBState)
2217  {
2218  case 0: // nothing
2220  break;
2221  case tobs_Foraging: // Forage
2222  switch (st_Forage())
2223  {
2224  case 0:
2225  m_StepDone=true;
2226  break;
2227  case 1:
2229  m_StepDone=true;
2230  break;
2231  case 2:
2233  m_StepDone=true;
2234  break;
2235  }
2236  break;
2237  case tobs_Aggregating: // Aggregate
2238  switch (st_Aggregate())
2239  {
2240  case 0:
2241  m_StepDone=true;
2242  break;
2243  case 1:
2245  m_StepDone=true;
2246  break;
2247  case 2:
2249  m_StepDone=true;
2250  break;
2251  default:
2252  // Should never happen
2253  m_OurLandscape->Warn("Bembidion Adult Unknown Return State From st_Aggregate",NULL);
2254  exit(1);
2255  }
2256  break;
2257  case tobs_Hibernating: // Hibernate
2258  switch (st_Hibernate())
2259  {
2260  case 0:
2261  m_StepDone=true;
2262  break;
2263  case 1:
2264  CurrentBState=tobs_Dispersing; // Dispersal
2265  m_StepDone=true;
2266  break;
2267  default:
2268  m_OurLandscape->Warn("Bembidion Adult Unknown Return State From st_Hibernate",NULL);
2269  exit(1);
2270  break;
2271  }
2272  break;
2273  case tobs_Dispersing: // Disperse
2274  switch (st_Dispersal())
2275  {
2276  case 0:
2277  m_EggCounter=cfg_TotalNoEggs.value(); // start the egg production counter
2278  CurrentBState=tobs_Foraging; // Forage
2279  m_StepDone=true;
2280  break;
2281  case 2:
2282  CurrentBState=tobs_ADying; // die
2283  break;
2284  default:
2285  m_OurLandscape->Warn("Bembidion Adult Unknown Return State From st_Dispersal",NULL);
2286  exit(1);
2287  }
2288  break;
2289  case tobs_ADying: // Die
2291  st_Die();
2292  m_StepDone=true;
2293  break;
2294  default:
2295  m_OurLandscape->Warn("Bembidion Adult Unknown State",NULL);
2296  g_msg->Warn(WARN_BUG, "State attempted was: ", int(CurrentBState));
2297  exit(1);
2298  }
2299 }
static CfgInt cfg_TotalNoEggs("BEM_TOTALEGGS", CFG_CUSTOM, 256)
The maximum number of eggs it is possible to produce per female.
@ tobs_Aggregating
Definition: bembidion_all.h:50
@ tobs_Dispersing
Definition: bembidion_all.h:52
@ tobs_Foraging
Definition: bembidion_all.h:49
int st_Hibernate()
Hibernation behaviour.
Definition: Bembidion_all.cpp:1635
int st_Aggregate()
Aggregation behaviour.
Definition: Bembidion_all.cpp:1624
int st_Forage()
Foraging behaviour.
Definition: Bembidion_all.cpp:1604
int st_Dispersal()
Intiate Dispersal behaviour.
Definition: Bembidion_all.cpp:1669
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
@ WARN_BUG
Definition: maperrormsg.h:34

References cfg_TotalNoEggs, SimplePositionMap::ClearMapValue(), Bembidion_Base::CurrentBState, g_msg, Bembidion_Population_Manager::m_AdultPosMap, TALMaSSObject::m_CurrentStateNo, m_EggCounter, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Bembidion_Base::m_OurPopulation, TALMaSSObject::m_StepDone, st_Aggregate(), Bembidion_Base::st_Die(), st_Dispersal(), st_Forage(), st_Hibernate(), tobs_ADying, tobs_Aggregating, tobs_Dispersing, tobs_Foraging, tobs_Hibernating, CfgInt::value(), MapErrorMsg::Warn(), Landscape::Warn(), and WARN_BUG.

◆ WinterMort()

bool Bembidion_Adult::WinterMort ( )
protected

Density-independent winter mortality.

1699 {
1700  // Beetles are immobile during winter so only call this once at the
1701  // end of overwintering
1702  double mortchance;
1703  if (m_negDegrees>-40)
1704  {
1705  mortchance = 0.94925+(m_negDegrees*0.00426);
1706  }
1707  else if (m_negDegrees>-80)
1708  {
1709  mortchance = 1.16913+(m_negDegrees*0.01149);
1710  }
1711  else if (m_negDegrees>-107)
1712  {
1713  mortchance = 0.6665+(m_negDegrees*0.00528);
1714  }
1715  else mortchance=0.1; // max 90% mortality
1716  if (random(1000) < ((1-mortchance)*1000)) return true; // die
1717  else return false;
1718 }

References m_negDegrees, and random().

Referenced by st_Dispersal().

Member Data Documentation

◆ m_AdultPPPElimRate

double Bembidion_Adult::m_AdultPPPElimRate = 0
staticprotected

the daily elimination rate for pesticides

Referenced by EndStep(), and SetAdultPPPElimRate().

◆ m_body_burden

double Bembidion_Adult::m_body_burden
protected

Current body burden of pesticide.

Referenced by EndStep(), Init(), InternalPesticideHandlingAndResponse(), and SetBodyBurden().

◆ m_CanReproduce

bool Bembidion_Adult::m_CanReproduce
protected

Signal reproductive readiness.

Referenced by CanReproduce(), Init(), st_Aging(), st_Forage(), and st_Hibernate().

◆ m_currentPPPEffectProb

double Bembidion_Adult::m_currentPPPEffectProb
protected

Current effect probability.

Referenced by EndStep(), Init(), and InternalPesticideHandlingAndResponse().

◆ m_EggCounter

int Bembidion_Adult::m_EggCounter
protected

The number of eggs produced.

Referenced by CanReproduce(), Init(), st_Aging(), and Step().

◆ m_HibernateDegrees

double Bembidion_Adult::m_HibernateDegrees
protected

The number of day degrees experienced in the spring which may trigger dispersal.

Referenced by Init(), and st_Hibernate().

◆ m_negDegrees

double Bembidion_Adult::m_negDegrees
protected

The number of negative day degrees experienced.

Referenced by Init(), st_Aging(), and WinterMort().

◆ m_PPPEffectProb

double Bembidion_Adult::m_PPPEffectProb = 0
staticprotected

Effect probability on threshold excedence.

Referenced by InternalPesticideHandlingAndResponse(), and SetPPPEffectProb().

◆ m_PPPEffectProbDecay

double Bembidion_Adult::m_PPPEffectProbDecay = 0
staticprotected

Effect probability on threshold excedence.

Referenced by InternalPesticideHandlingAndResponse(), and SetPPPEffectProbDecay().

◆ m_PPPThreshold

double Bembidion_Adult::m_PPPThreshold = 0
staticprotected

PPP effects threshold.

Referenced by InternalPesticideHandlingAndResponse(), and SetPPPThreshold().

◆ OldDirection

int Bembidion_Adult::OldDirection
protected

The last direction moved.

Referenced by DailyMovement(), Init(), MoveTo(), and MoveToAggr().

◆ pList

param_List15 Bembidion_Adult::pList
staticprotected

A helper attribute when simulating movement.

Static array to hold the history of adult positions.

Referenced by CanReproduce(), and MoveTo().

◆ pPoint

param_Point Bembidion_Adult::pPoint
staticprotected

A helper attribute when simulating movement.

Static array to hold a list of co-ordinates.

Referenced by MoveTo(), and MoveTo_quality_assess().


The documentation for this class was generated from the following files: